<template>
  <div class="table-form">
    <el-form ref="formRef" :model="form" :inline="true" class="pro-select-box">
      <el-form-item :label="t('common.time')" prop="time">
        <el-date-picker
          v-model="form.time"
          type="datetimerange"
          range-separator="To"
        />
      </el-form-item>
      <el-form-item label="批次号" prop="lot">
        <el-input v-model="form.lot" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="query">{{
          t("common.queryText")
        }}</el-button>
        <el-button
          type="success"
          @click="output('产品信息')"
          :loading="downloading"
          >{{ t("common.export") }}</el-button
        >
      </el-form-item>
    </el-form>
    <hcTable
      :table-data="list"
      :options="options"
      :columns="tableColumn"
      @size-change="handlerPageSize"
      @current-change="handlerPageIndex"
      @command="handleAction"
    >
    </hcTable>
  </div>
</template>
<script setup>
import { reactive } from "vue";
import useQueryTable from "@/hooks/useQueryTable";
import { initTime } from "@/utils";
import { useI18n } from "vue-i18n";
let { t } = useI18n();
let form = reactive({
  time: initTime(),
  lot: "",
});

let tableColumn = [
  { type: "index", width: "60", label: "NO.", align: "center", fixed: true },
  { prop: "factoryCode", label: t("common.time"), align: "center" },
  { prop: "deviceCode", label: "批次号", align: "center" },
  { prop: "deviceName", label: "质量", align: "center" },
  //   {
  //     width: "120",
  //     label: t('common.operate'),
  //     align: "center",
  //     buttons: [
  //       {
  //         name: t('common.edit'),
  //         type: "warning",
  //         command: "edit",
  //       },
  //       {
  //         name: t('common.delText'),
  //         type: "danger",
  //         command: "delete",
  //       },
  //     ],
  //   },
];

let {
  list,
  query,
  output,
  options,
  downloading,
  handleAction,
  handlerPageSize,
  handlerPageIndex,
} = useQueryTable({ get: "/" }, form, {
  time: true,
});
</script>
<style lang="scss" scoped></style>